
// var server = require('net').createServer();

// var child = require('child_process').fork(__dirname + '/2.js');

// // Open up the server object and send the handle.
// server.listen(1337, function() {
//   child.send({ server: true }, server._handle);
// });

function startWorker(handle){

  output("start workers :" + WORKER_NUMBER);
  worker_succ_count = 0;
  for(var i=0; i    var c  =  cp.fork(WORKER_PATH);
    c.send({"server" : true}, handle);
  }
}

function startServer(){

  var tcpServer = net.createServer();
  tcpServer.on("error", function(err){
    output("server error ,check the port...");
    about_exit();
  })  

  tcpServer.listen(PORT , function(){
    startWorker(tcpServer._handle);
    tcpServer.close();
  }); 

}

startServer();